﻿using ImageManager.MyExcep;
using System.Runtime.CompilerServices;

namespace ImageManager.Common
{
    public class ConfigReader
    {
        public static string ReadSetting(string section, string key)
        {
            try
            {
                var result = RuntimeVariable.GLOBAL_CONFIG.GetSection(section)[key];
                if (result == null)
                    throw new MyConfigException($"无法找到{section}-{key}的参数值");
                return result;
            }
            catch (Exception ex)
            {
                throw new MyConfigException(ex.Message, ex);
            }
        }
    }
}
